Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dear Meiro.io team, appologies for trying to push directly to your repo ( i managed to do the fork but i lost the history ), anyway, lets get straight into the solution :
technologies used: react , mui , react-router ,react-query, recoil, use-query-params
I tried to solve the data persistence through routes in there different ways:
1- using query params as global state (/attributes1) :
Pros:
-the url is reachable
cons :
-additional depndency (use-query-params)
-need to to validate the url params on the top of the route
2- passing data between routes using react-router navigate (/attributes2) :
Pros:
-No need for additional dependency (use react-router only )
Cons :
-Might be unreliable
3- using global state manager (/attributes3) :
-pros: works as expected
-Cons:
additional dependency (recoil)
Need to reset the global state inside each route (except the sub-route /attribute )
Additions :
- implemented toast message for showing success / error messages
Todos :
- handle errors
- store users scroll position for better ux
- better UI design
Pitfalls :
- infiniteQuery spits some typing errors
- mapping ids to labels might be slow ( I would rather do the mapping on backend so frontend as it can be faster )